{layout name="public/layout" /}
<!-- 内容主体区域 -->
<div class="site-block">
    <blockquote class="layui-elem-quote">
            <span class="layui-breadcrumb" lay-separator=">">
                <a href="">首页</a>
                <a><cite>广告管理</cite></a>
            </span>
    </blockquote>
    <fieldset class="layui-elem-field">
        <div class="layui-field-box">
            <form class="layui-form layui-form-pane"  method="post">
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                        <a href="{:url('Ad/adconf')}"><div class="layui-btn">添加广告</div></a>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input type="text" name="tp_name" placeholder="如：首页广告" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-btn layui-btn-normal" lay-submit="" lay-filter="formDemo">添加分类</div>
                    </div>
                </div>
            </form>

            <div class="layui-tab layui-tab-card">
                <ul class="layui-tab-title">
                    {volist name="ad_type" id="vo"}
                    <li {if condition="$vo['id'] eq 1" }class="layui-this"{/if}>{$vo.tp_name}
                    <span class="layui-badge layui-bg-blue">ID:{$vo.id}</span>
                </li>
                    {/volist}
                </ul>
                <div class="layui-tab-content">
                    {volist name="ad_type" id="voo"}
                    <div class="layui-tab-item {if condition="$voo['id'] eq 1" }layui-show{/if}">
                        <table class="layui-table" lay-size="ls">
                            <colgroup>
                                <col width="80">
                                <col width="150">
                                <col width="150">
                                <col width="150">
                                <col width="150">
                            </colgroup>
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>广告名称</th>
                                <th>是否限时</th>
                                <th>结束时间</th>
                                <th>管理</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="adlist" id="advo"}
                            {if condition="$advo['ad_type'] eq $voo['id']"}
                            <tr id="ad_id_{$advo.id}">
                                <td>{$advo['id']}</td>
                                <td>{$advo['ad_name']}</td>
                                <td>{$advo['ad_time_type']|getAdTime}</td>
                                <td>{$advo['ad_o']}</td>
                                <td>
                                    <div class="layui-btn-group">
                                        <a href="{:url('Ad/adconf',['id'=>$advo['id']])}"><button class="layui-btn layui-btn-sm"><i class="layui-icon"></i>修改 </button></a>
                                        {eq name="advo.ad_system" value="1"}
                                        <button class="layui-btn layui-btn-sm layui-btn-disabled"><i class="layui-icon"></i>删除 </button>
                                        {else /}
                                        <button class="layui-btn layui-btn-sm" onclick="delid('{$advo.id}');"><i class="layui-icon"></i>删除 </button>
                                        {/eq}
                                    </div>
                                </td>
                            </tr>

                            {/if}
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                   {/volist}
                </div>
            </div>
        </div>
    </fieldset>
</div>
<script>

    alertPost('formDemo', '{:url("Ad/adtype")}', true);
    function delid(id) {
        Pdel(id, 'id=' + id, '{:url("Ad/addel")}', '#ad_id_');
    }
</script>